package com.hailian.fintech.hlrenting_houseserver.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hailian.fintech.hlrenting_houseserver.entity.ContractVo;
import com.hailian.fintech.hlrenting_houseserver.service.IContractService;
import com.hailian.fintech.hlrenting_houseserver.vo.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wyt
 * @since 2020-05-21
 */
@RestController
@RequestMapping("/contract")
public class ContractController {

    //实现业务
    @Autowired
    private IContractService contractService;

    /***
     * 测试列表接口
     * @return
     */
    @RequestMapping("/test")
    public ResultEntity test(){
        return ResultEntity.ok("成功访问数据",contractService.list());
    }

    /***
     * 续约合同接口  记录查询
     * @return
     */
    @RequestMapping("/list")
    public ResultEntity list(@RequestParam("pageNum")Integer pageNum, @RequestParam("pageSize")Integer pageSize, ContractVo vo){
        Page<ContractVo> page = new Page<>(pageNum, pageSize);
        return ResultEntity.ok("成功访问数据",contractService.selectObject(page,vo));
    }

}

